import React, { PureComponent, memo } from 'react'
import PropTypes from 'prop-types'
import VideoItem from 'components/VideoItem/VideoItem'
const Partition = memo(function Partition(props) {
    const { data, history, getPicUrl } = props
    return (
        <>
            <div className="flex recommand middle">
                <div className="title l cell-main">{data.name}</div>
                <div
                    className="flex middle"
                    onClick={() => {
                        window.location.href = `/channel/${data.id}`
                    }}
                >
                    <span className="l mr5">查看更多</span>
                    <i className="xl mr5 icon-arrow-right" />
                </div>
            </div>
            <div className="flex middle wrap">
                {data.videos.map((item, i) => {
                    if (item.pic && item.pic.indexOf('@320w_200h') === -1) {
                        item.pic = getPicUrl(item.pic, '@320w_200h')
                    }
                    return <VideoItem video={item} key={i} showStatistics={true} />
                })}
            </div>
        </>
    )
})
export default Partition
